package com.xuexiang.xuidemo.util;

import com.xuexiang.xui_lib.XUI;
import com.xuexiang.xui_lib.component.toast.XToast;

public class XToastUtils {
    private XToastUtils() {
        throw new UnsupportedOperationException("u can't instantiate me...");
    }

    static {
        XToast.Config.get()
                .setAlpha(200)
                .allowQueue(false);
    }


    public static void toast(String message) {
        XToast.normal(XUI.getContext(), message).show();
    }

    public static void toast(int message) {
        XToast.normal(XUI.getContext(), message).show();
    }

    public static void toast(String message, int duration) {
        XToast.normal(XUI.getContext(), message, duration).show();
    }

    public static void toast(int message, int duration) {
        XToast.normal(XUI.getContext(), message, duration).show();
    }

    //=============//
    public static void error(String message) {
        XToast.error(XUI.getContext(), message).show();
    }

    public static void error(Exception error) {
        XToast.error(XUI.getContext(), error.getMessage()).show();
    }

    public static void error(int message) {
        XToast.error(XUI.getContext(), message).show();
    }

    public static void error(String message, int duration) {
        XToast.error(XUI.getContext(), message, duration).show();
    }

    public static void error(int message, int duration) {
        XToast.error(XUI.getContext(), message, duration).show();
    }

    //=============//
    public static void success(String message) {
        XToast.success(XUI.getContext(), message).show();
    }

    public static void success(int message) {
        XToast.success(XUI.getContext(), message).show();
    }

    public static void success(String message, int duration) {
        XToast.success(XUI.getContext(), message, duration).show();
    }

    public static void success(int message, int duration) {
        XToast.success(XUI.getContext(), message, duration).show();
    }

    //=============//
    public static void info(String message) {
        XToast.info(XUI.getContext(), message).show();
    }

    public static void info(int message) {
        XToast.info(XUI.getContext(), message).show();
    }

    public static void info(String message, int duration) {
        XToast.info(XUI.getContext(), message, duration).show();
    }

    public static void info(int message, int duration) {
        XToast.info(XUI.getContext(), message, duration).show();
    }

    //=============//

    public static void warning(String message) {
        XToast.warning(XUI.getContext(), message).show();
    }

    public static void warning(int message) {
        XToast.warning(XUI.getContext(), message).show();
    }

    public static void warning(String message, int duration) {
        XToast.warning(XUI.getContext(), message, duration).show();
    }

    public static void warning(int message, int duration) {
        XToast.warning(XUI.getContext(), message, duration).show();
    }

}
